<?php 
function validateSignup($fname, $lname, $email, $pass){
  $fnameErr= "";
  $lnameErr = "";
  $emailErr = "";
  $passErr = "";
  //Check on First Name
  if (empty($fname)){
    $fnameErr = "First name is required";
  }
  elseif(!preg_match("/^[a-zA-Z ]*$/",$fname)){
    $fnameErr = "Only letters and white space allowed"; 
  }

  //Check on Last Name
  if (empty($lname)){
    $lnameErr = "Last name is required";
  }
  elseif(!preg_match("/^[a-zA-Z ]*$/",$lname)){
    $lnameErr = "Only letters and white space allowed"; 
  }

  //Check on email address
  if (empty($email)){
    $emailErr = "Email is required";
  }
  elseif(!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)){
    $emailErr = "Invalid email format"; 
  }

  if(empty($pass)){
    $passErr = "Password is required.";
  }
  elseif(!preg_match('/^[a-zA-Z0-9@_]*$/',$pass)){
    $passErr = "Invalid Format.";
  }
  elseif(strlen($pass) < 6){
    $passErr = "Password must be atleast 6 char.";
  }
  if(empty($fnameErr) and empty($lnameErr) and empty($emailErr) and empty($passErr)){
    return array(true);
  }
  return array(false, $fnameErr, $lnameErr, $emailErr, $passErr);
}

function validateLogin($email, $pass, $usertype)
{

}
?>